/**
 * Created with IntelliJ IDEA.
 * User: ajhin
 * Date: 8/4/14
 * Time: 7:23 AM
 * To change this template use File | Settings | File Templates.
 */
package societyGames.codeAlong.model
{
import societyGames.xmlFragment.XMLFragment;

public class Entry extends XMLFragment
{
  override protected function getDefaultXML():XML
  {
    return _defaultXML;
  }

  public function get id():String
  {
    return _xml.@id;
  }

  [Bindable]
  public function set id(value:String):void
  {
    _xml.@id = value;
  }

  public function get nodeText():String
  {
    return _xml.children()[0].toString();
  }

  //TODO: Add a validator? Should be a single XML node.
  [Bindable]
  public function set nodeText(value:String):void
  {
    _xml.setChildren(value);
  }

  public function get xmlChildren():XMLList
  {
    return _xml.*;
  }

  [Bindable]
  public function set xmlChildren(value:XMLList):void
  {
    _xml.setChildren(value);
  }

  private const _defaultXML:XML =
          <entry id=""/>;
}
}
